package dbexp.utils;

public class Unicode {
	public static String decode(String in) {
		String out = in;
		if (out != null) {
			out.replaceAll("&#260;", "Ą");
			out.replaceAll("&#261;", "ą");
			out.replaceAll("&#262;", "Ć");
			out.replaceAll("&#263;", "ć");
			out.replaceAll("&#280;", "Ę");
			out.replaceAll("&#281;", "ę");
			out.replaceAll("&#321;", "Ł");
			out.replaceAll("&#322;", "ł");
			out.replaceAll("&#323;", "Ń");
			out.replaceAll("&#324;", "ń");
			out.replaceAll("&#211;", "Ó");
			out.replaceAll("&#243;", "ó");
			out.replaceAll("&#346;", "Ś");
			out.replaceAll("&#347;", "ś");
			out.replaceAll("&#377;", "Ź");
			out.replaceAll("&#378;", "ź");
			out.replaceAll("&#379;", "Ż");
			out.replaceAll("&#380;", "ż");
		}
		return out;
	}

	public static String encode(String in) {
		String out = in;
		if (out != null) {
			out.replaceAll("Ą", "&#260;");
			out.replaceAll("ą", "&#261;");
			out.replaceAll("Ć", "&#262;");
			out.replaceAll("ć", "&#263;");
			out.replaceAll("Ę", "&#280;");
			out.replaceAll("ę", "&#281;");
			out.replaceAll("Ł", "&#321;");
			out.replaceAll("ł", "&#322;");
			out.replaceAll("Ń", "&#323;");
			out.replaceAll("ń", "&#324;");
			out.replaceAll("Ó", "&#211;");
			out.replaceAll("ó", "&#243;");
			out.replaceAll("Ś", "&#346;");
			out.replaceAll("ś", "&#347;");
			out.replaceAll("Ź", "&#377;");
			out.replaceAll("ź", "&#378;");
			out.replaceAll("Ż", "&#379;");
			out.replaceAll("ż", "&#380;");
		}
		return out;
	}

}
